<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="robots" content="noodp" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
        <title>《Linxu下安装Mysql教程》 - Lucklyの博客 - 在阅读中遇见自己</title><meta name="Description" content="早起的年轻人做的网站"><meta property="og:title" content="《Linxu下安装Mysql教程》" />
<meta property="og:description" content="
本教程手把手教你如何在 Linux 安装 MySQL 数据库，以 CentOS 8为例。

4.23日，我买了阿里云的服务器centos7，安装mysql，特此记录一下，方便自己以后查找使用" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://luckly.work/linxu%E4%B8%8B%E5%AE%89%E8%A3%85mysql%E6%95%99%E7%A8%8B/" />
<meta property="og:image" content="https://luckly.work/logo.png"/>
<meta property="article:published_time" content="2021-04-23T07:18:48+08:00" />
<meta property="article:modified_time" content="2021-04-23T07:18:48+08:00" />
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="https://luckly.work/logo.png"/>

<meta name="twitter:title" content="《Linxu下安装Mysql教程》"/>
<meta name="twitter:description" content="
本教程手把手教你如何在 Linux 安装 MySQL 数据库，以 CentOS 8为例。

4.23日，我买了阿里云的服务器centos7，安装mysql，特此记录一下，方便自己以后查找使用"/>
<meta name="application-name" content="LoveIt">
<meta name="apple-mobile-web-app-title" content="LoveIt"><meta name="theme-color" content="#ffffff"><meta name="msapplication-TileColor" content="#da532c"><link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
        <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
        <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"><link rel="manifest" href="/site.webmanifest"><link rel="canonical" href="https://luckly.work/linxu%E4%B8%8B%E5%AE%89%E8%A3%85mysql%E6%95%99%E7%A8%8B/" /><link rel="prev" href="https://luckly.work/nginx%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/" /><link rel="next" href="https://luckly.work/go%E5%AD%A6%E4%B9%A0%E8%B5%84%E6%96%99%E5%AF%BC%E8%88%AA/" /><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/normalize.css@8.0.1/normalize.min.css"><link rel="stylesheet" href="/css/style.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.13.0/css/all.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.7.2/animate.min.css"><script type="application/ld+json">
    {
        "@context": "http://schema.org",
        "@type": "BlogPosting",
        "headline": "《Linxu下安装Mysql教程》",
        "inLanguage": "zh-CN",
        "mainEntityOfPage": {
            "@type": "WebPage",
            "@id": "https:\/\/luckly.work\/linxu%E4%B8%8B%E5%AE%89%E8%A3%85mysql%E6%95%99%E7%A8%8B\/"
        },"image": [{
                            "@type": "ImageObject",
                            "url": "https:\/\/luckly.work\/images\/Apple-Devices-Preview.png",
                            "width":  3200 ,
                            "height":  2048 
                        }],"genre": "posts","keywords": "linux, Mysql, 安装教程","wordcount":  1573 ,
        "url": "https:\/\/luckly.work\/linxu%E4%B8%8B%E5%AE%89%E8%A3%85mysql%E6%95%99%E7%A8%8B\/","datePublished": "2021-04-23T07:18:48+08:00","dateModified": "2021-04-23T07:18:48+08:00","license": "This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.","publisher": {
            "@type": "Organization",
            "name": "xxxx","logo": {
                    "@type": "ImageObject",
                    "url": "https:\/\/luckly.work\/images\/avatar.png",
                    "width":  528 ,
                    "height":  560 
                }},"author": {
                "@type": "Person",
                "name": "早起的年轻人"
            },"description": ""
    }
    </script></head>
    <body header-desktop="fixed" header-mobile="auto"><script type="text/javascript">(window.localStorage && localStorage.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('auto' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : 'auto' === 'dark')) && document.body.setAttribute('theme', 'dark');</script>

        <div id="mask"></div><div class="wrapper"><header class="desktop" id="header-desktop">
    <div class="header-wrapper">
        <div class="header-title">
            <a href="/" title="Lucklyの博客 - 在阅读中遇见自己"><span class="header-title-pre"><i class='far fa-kiss-wink-heart fa-fw'></i></span><span id="id-1" class="typeit"></span></a>
        </div>
        <div class="menu">
            <div class="menu-inner"><a class="menu-item" href="/posts/"> 所有文章 </a><a class="menu-item" href="/categories/flutter/"> Flutter </a><a class="menu-item" href="/categories/read/"> 读书笔记 </a><a class="menu-item" href="/categories/go/"> Go </a><a class="menu-item" href="/tags/"> 标签 </a><a class="menu-item" href="/categories/"> 分类 </a><a class="menu-item" href="/about/"> 关于 </a><a class="menu-item" href="https://github.com/ITmxs" title="GitHub" rel="noopener noreffer" target="_blank"><i class='fab fa-github fa-fw'></i> Github </a><a class="menu-item" href="/friend/"><i class='fas fa-user-friends'></i> 友链 </a><span class="menu-item delimiter"></span><span class="menu-item search" id="search-desktop">
                        <input type="text" placeholder="搜索文章标题或内容..." id="search-input-desktop">
                        <a href="javascript:void(0);" class="search-button search-toggle" id="search-toggle-desktop" title="搜索">
                            <i class="fas fa-search fa-fw"></i>
                        </a>
                        <a href="javascript:void(0);" class="search-button search-clear" id="search-clear-desktop" title="清空">
                            <i class="fas fa-times-circle fa-fw"></i>
                        </a>
                        <span class="search-button search-loading" id="search-loading-desktop">
                            <i class="fas fa-spinner fa-fw fa-spin"></i>
                        </span>
                    </span><a href="javascript:void(0);" class="menu-item theme-switch" title="切换主题">
                    <i class="fas fa-adjust fa-fw"></i>
                </a>
            </div>
        </div>
    </div>
</header><header class="mobile" id="header-mobile">
    <div class="header-container">
        <div class="header-wrapper">
            <div class="header-title">
                <a href="/" title="Lucklyの博客 - 在阅读中遇见自己"><span class="header-title-pre"><i class='far fa-kiss-wink-heart fa-fw'></i></span><span id="id-2" class="typeit"></span></a>
            </div>
            <div class="menu-toggle" id="menu-toggle-mobile">
                <span></span><span></span><span></span>
            </div>
        </div>
        <div class="menu" id="menu-mobile"><div class="search-wrapper">
                    <div class="search mobile" id="search-mobile">
                        <input type="text" placeholder="搜索文章标题或内容..." id="search-input-mobile">
                        <a href="javascript:void(0);" class="search-button search-toggle" id="search-toggle-mobile" title="搜索">
                            <i class="fas fa-search fa-fw"></i>
                        </a>
                        <a href="javascript:void(0);" class="search-button search-clear" id="search-clear-mobile" title="清空">
                            <i class="fas fa-times-circle fa-fw"></i>
                        </a>
                        <span class="search-button search-loading" id="search-loading-mobile">
                            <i class="fas fa-spinner fa-fw fa-spin"></i>
                        </span>
                    </div>
                    <a href="javascript:void(0);" class="search-cancel" id="search-cancel-mobile">
                        取消
                    </a>
                </div><a class="menu-item" href="/posts/" title="">所有文章</a><a class="menu-item" href="/categories/flutter/" title="">Flutter</a><a class="menu-item" href="/categories/read/" title="">读书笔记</a><a class="menu-item" href="/categories/go/" title="">Go</a><a class="menu-item" href="/tags/" title="">标签</a><a class="menu-item" href="/categories/" title="">分类</a><a class="menu-item" href="/about/" title="">关于</a><a class="menu-item" href="https://github.com/ITmxs" title="GitHub" rel="noopener noreffer" target="_blank"><i class='fab fa-github fa-fw'></i>Github</a><a class="menu-item" href="/friend/" title=""><i class='fas fa-user-friends'></i>友链</a><a href="javascript:void(0);" class="menu-item theme-switch" title="切换主题">
                <i class="fas fa-adjust fa-fw"></i>
            </a></div>
    </div>
</header>
<div class="search-dropdown desktop">
    <div id="search-dropdown-desktop"></div>
</div>
<div class="search-dropdown mobile">
    <div id="search-dropdown-mobile"></div>
</div>
<main class="main">
                <div class="container"><div class="toc" id="toc-auto">
            <h2 class="toc-title">目录</h2>
            <div class="toc-content" id="toc-content-auto"></div>
        </div><article class="page single"><h1 class="single-title animated flipInX">《Linxu下安装Mysql教程》</h1><div class="post-meta">
            <div class="post-meta-line"><span class="post-author"><a href="/" title="Author" rel=" author" class="author"><i class="fas fa-user-circle fa-fw"></i>早起的年轻人</a></span>&nbsp;<span class="post-category">收录于 <a href="/categories/linux/"><i class="far fa-folder fa-fw"></i>linux</a>&nbsp;<a href="/categories/mysql/"><i class="far fa-folder fa-fw"></i>Mysql</a>&nbsp;<a href="/categories/%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B/"><i class="far fa-folder fa-fw"></i>安装教程</a></span></div>
            <div class="post-meta-line"><i class="far fa-calendar-alt fa-fw"></i>&nbsp;<time datetime="2021-04-23">2021-04-23</time>&nbsp;<i class="fas fa-pencil-alt fa-fw"></i>&nbsp;约 1573 字&nbsp;
                <i class="far fa-clock fa-fw"></i>&nbsp;预计阅读 4 分钟&nbsp;<span id="/linxu%E4%B8%8B%E5%AE%89%E8%A3%85mysql%E6%95%99%E7%A8%8B/" class="leancloud_visitors" data-flag-title="《Linxu下安装Mysql教程》">
                        <i class="far fa-eye fa-fw"></i>&nbsp;<span class=leancloud-visitors-count></span>&nbsp;次阅读
                    </span>&nbsp;</div>
        </div><div class="featured-image"><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://luckly007.oss-cn-beijing.aliyuncs.com/img/linux.jpg"
        data-srcset="https://luckly007.oss-cn-beijing.aliyuncs.com/img/linux.jpg, https://luckly007.oss-cn-beijing.aliyuncs.com/img/linux.jpg 1.5x, https://luckly007.oss-cn-beijing.aliyuncs.com/img/linux.jpg 2x"
        data-sizes="auto"
        alt="https://luckly007.oss-cn-beijing.aliyuncs.com/img/linux.jpg"
        title="https://luckly007.oss-cn-beijing.aliyuncs.com/img/linux.jpg" /></div><div class="details toc" id="toc-static"  kept="">
                <div class="details-summary toc-title">
                    <span>目录</span>
                    <span><i class="details-icon fas fa-angle-right"></i></span>
                </div>
                <div class="details-content toc-content" id="toc-content-static"><nav id="TableOfContents">
  <ul>
    <li>
      <ul>
        <li>
          <ul>
            <li><a href="#1-下载并安装-mysql-官方的-yum-repository">1. 下载并安装 MySQL 官方的 Yum Repository</a></li>
            <li><a href="#2-mysql数据库设置">2. MySQL数据库设置</a>
              <ul>
                <li><a href="#21-设置不区分大小写">2.1. 设置不区分大小写</a></li>
                <li><a href="#22-启动mysql">2.2. 启动MySQL</a></li>
                <li><a href="#23-查看mysql运行状态">2.3. 查看MySQL运行状态</a></li>
                <li><a href="#24-设置密码">2.4. 设置密码</a></li>
                <li><a href="#25-设置远程访问">2.5. 设置远程访问</a>
                  <ul>
                    <li><a href="#251-开放端口">2.5.1 开放端口</a></li>
                  </ul>
                </li>
                <li><a href="#252-root远程访问">2.5.2. root远程访问</a></li>
                <li><a href="#26阿里云设置安全组需要开放3306端口">2.6阿里云设置安全组需要开放3306端口</a></li>
                <li><a href="#27-2059错误的解决方案">2.7 2059错误的解决方案</a></li>
              </ul>
            </li>
          </ul>
        </li>
      </ul>
    </li>
  </ul>
</nav></div>
            </div><div class="content" id="content"><blockquote>
<p>本教程手把手教你如何在 Linux 安装 MySQL 数据库，以 CentOS 8为例。</p>
</blockquote>
<p>4.23日，我买了阿里云的服务器centos7，安装mysql，特此记录一下，方便自己以后查找使用</p>
<p>[TOC]</p>
<h3 id="1-下载并安装-mysql-官方的-yum-repository">1. 下载并安装 MySQL 官方的 Yum Repository</h3>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-shell" data-lang="shell">wget https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
</code></pre></td></tr></table>
</div>
</div><p>使用上面的命令就直接下载了安装用的Yum Repository，大概25KB的样子，然后就可以直接yum安装了。</p>
<p>2、然后进行repo的安装：</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-shell" data-lang="shell">rpm -ivh mysql80-community-release-el7-1.noarch.rpm
</code></pre></td></tr></table>
</div>
</div><p>执行完成后会在/etc/yum.repos.d/目录下生成两个repo文件mysql-community.repo mysql-community-source.repo</p>
<p>之后就开始安装MySQL服务器。</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-shell" data-lang="shell"> yum install mysql-server
</code></pre></td></tr></table>
</div>
</div><p>这步可能会花些时间，安装完成后就会覆盖掉之前的mariadb。</p>
<p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png"
        data-srcset="https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png, https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png 1.5x, https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png 2x"
        data-sizes="auto"
        alt="https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png"
        title="Linux 安装 MySQL 8 数据库1.png" /></p>
<p>然而，好像这些信息对我们来说并没有什么用处，什么守护进程没启动，我们也不能知如何去启动这些，这个时候我们查看一下mysql自带的告警日志，路径一般在/var/log/mysqld.log下面</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-fallback" data-lang="fallback">tail -200f  /var/log/mysqld.log
</code></pre></td></tr></table>
</div>
</div><p><a href="https://blog.csdn.net/liurui50/article/details/105478422">https://blog.csdn.net/liurui50/article/details/105478422</a></p>
<h3 id="2-mysql数据库设置">2. MySQL数据库设置</h3>
<h4 id="21-设置不区分大小写">2.1. 设置不区分大小写</h4>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-shell" data-lang="shell">vim /etc/my.cnf
</code></pre></td></tr></table>
</div>
</div><p>在[mysqld]下，添加以下内容</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-shell" data-lang="shell"><span class="c1">#让MYSQL大小写敏感(1-不敏感，0-敏感)</span>
<span class="nv">lower_case_table_names</span><span class="o">=</span><span class="m">1</span>
</code></pre></td></tr></table>
</div>
</div><h4 id="22-启动mysql">2.2. 启动MySQL</h4>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-shell" data-lang="shell">systemctl start mysqld.service 
</code></pre></td></tr></table>
</div>
</div><h4 id="23-查看mysql运行状态">2.3. 查看MySQL运行状态</h4>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-shell" data-lang="shell">systemctl status mysqld.service
</code></pre></td></tr></table>
</div>
</div><p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png"
        data-srcset="https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png, https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png 1.5x, https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png 2x"
        data-sizes="auto"
        alt="https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png"
        title="Linux 安装 MySQL 8 数据库2.png" /></p>
<h4 id="24-设置密码">2.4. 设置密码</h4>
<p>此时MySQL已经开始正常运行，不过要想进入MySQL还得先找出此时root用户的密码，通过如下命令可以在日志文件中找出密码：</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-shell" data-lang="shell">grep <span class="s2">&#34;password&#34;</span> /var/log/mysqld.log
</code></pre></td></tr></table>
</div>
</div><p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png"
        data-srcset="https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png, https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png 1.5x, https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png 2x"
        data-sizes="auto"
        alt="https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png"
        title="Linux 安装 MySQL 8 数据库3.png" /></p>
<p>进入数据库：</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-shell" data-lang="shell">mysql -uroot -p
</code></pre></td></tr></table>
</div>
</div><p>输入刚刚上面的初始密码</p>
<p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png"
        data-srcset="https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png, https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png 1.5x, https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png 2x"
        data-sizes="auto"
        alt="https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png"
        title="Linux 安装 MySQL 8 数据库4.png" /></p>
<p>此时不能做任何事情，因为MySQL默认必须修改密码之后才能操作数据库：</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-SQL" data-lang="SQL"><span class="k">ALTER</span> <span class="k">USER</span> <span class="s1">&#39;root&#39;</span><span class="o">@</span><span class="s1">&#39;localhost&#39;</span> <span class="n">IDENTIFIED</span> <span class="k">BY</span> <span class="s1">&#39;new password&#39;</span><span class="p">;</span>
</code></pre></td></tr></table>
</div>
</div><p>new password为你设置的root密码 这里有个问题，新密码设置的时候如果设置的过于简单会报错：</p>
<p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png"
        data-srcset="https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png, https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png 1.5x, https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png 2x"
        data-sizes="auto"
        alt="https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png"
        title="Linux 安装 MySQL 8 数据库5.png" /> <img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png"
        data-srcset="https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png, https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png 1.5x, https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png 2x"
        data-sizes="auto"
        alt="https://luckly007.oss-cn-beijing.aliyuncs.com/img/00d8cefb-c782-4155-a8a9-057afe23ec41.png"
        title="Linux 安装 MySQL 8 数据库6.png" /></p>
<p>尽量把密码设置复杂一些</p>
<p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/8e66d86f-a429-4d52-9213-71150278f093.png"
        data-srcset="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/8e66d86f-a429-4d52-9213-71150278f093.png, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/8e66d86f-a429-4d52-9213-71150278f093.png 1.5x, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/8e66d86f-a429-4d52-9213-71150278f093.png 2x"
        data-sizes="auto"
        alt="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/8e66d86f-a429-4d52-9213-71150278f093.png"
        title="Linux 安装 MySQL 8 数据库7.png" /></p>
<h4 id="25-设置远程访问">2.5. 设置远程访问</h4>
<p>此时不能远程访问，如Navicat访问不了</p>
<p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/ab533966-d79b-41cf-8cad-b13520fc3b23.png"
        data-srcset="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/ab533966-d79b-41cf-8cad-b13520fc3b23.png, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/ab533966-d79b-41cf-8cad-b13520fc3b23.png 1.5x, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/ab533966-d79b-41cf-8cad-b13520fc3b23.png 2x"
        data-sizes="auto"
        alt="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/ab533966-d79b-41cf-8cad-b13520fc3b23.png"
        title="Linux 安装 MySQL 8 数据库8.png" />居中</p>
<h5 id="251-开放端口">2.5.1 开放端口</h5>
<p>（1）开放3306端口</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-shell" data-lang="shell">firewall-cmd --permanent --zone<span class="o">=</span>public --add-port<span class="o">=</span>3306/tcp
</code></pre></td></tr></table>
</div>
</div><p>（2）如果提示FirewallD is not running，如下图所示</p>
<p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/255341b9-e8be-45ed-8b94-70e39d501ec2.png"
        data-srcset="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/255341b9-e8be-45ed-8b94-70e39d501ec2.png, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/255341b9-e8be-45ed-8b94-70e39d501ec2.png 1.5x, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/255341b9-e8be-45ed-8b94-70e39d501ec2.png 2x"
        data-sizes="auto"
        alt="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/255341b9-e8be-45ed-8b94-70e39d501ec2.png"
        title="Linux 安装 MySQL 8 数据库9.png" /></p>
<p>（3）通过systemctl status firewalld查看firewalld状态，发现当前是dead状态，即防火墙未开启。</p>
<p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/76f1334f-29a2-482c-bede-f935918e3c98.png"
        data-srcset="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/76f1334f-29a2-482c-bede-f935918e3c98.png, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/76f1334f-29a2-482c-bede-f935918e3c98.png 1.5x, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/76f1334f-29a2-482c-bede-f935918e3c98.png 2x"
        data-sizes="auto"
        alt="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/76f1334f-29a2-482c-bede-f935918e3c98.png"
        title="Linux 安装 MySQL 8 数据库10.png" /></p>
<p>（4）通过systemctl start firewalld开启防火墙，没有任何提示即开启成功。</p>
<p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/18db6527-c26f-4bf2-ad8a-47b5dfa67671.png"
        data-srcset="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/18db6527-c26f-4bf2-ad8a-47b5dfa67671.png, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/18db6527-c26f-4bf2-ad8a-47b5dfa67671.png 1.5x, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/18db6527-c26f-4bf2-ad8a-47b5dfa67671.png 2x"
        data-sizes="auto"
        alt="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/18db6527-c26f-4bf2-ad8a-47b5dfa67671.png"
        title="Linux 安装 MySQL 8 数据库11.png" /></p>
<p>（5）再次通过systemctl status firewalld查看firewalld状态，显示running即已开启了。</p>
<p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/1b408e36-9ba5-44c7-a4c9-d11e6e10739a.png"
        data-srcset="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/1b408e36-9ba5-44c7-a4c9-d11e6e10739a.png, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/1b408e36-9ba5-44c7-a4c9-d11e6e10739a.png 1.5x, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/1b408e36-9ba5-44c7-a4c9-d11e6e10739a.png 2x"
        data-sizes="auto"
        alt="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/1b408e36-9ba5-44c7-a4c9-d11e6e10739a.png"
        title="Linux 安装 MySQL 8 数据库12.png" /></p>
<p>（6）如果要关闭防火墙设置，可能通过systemctl stop firewalld这条指令来关闭该功能。</p>
<p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/5a88a2db-3bbb-44ab-9b45-68a28af5f179.png"
        data-srcset="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/5a88a2db-3bbb-44ab-9b45-68a28af5f179.png, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/5a88a2db-3bbb-44ab-9b45-68a28af5f179.png 1.5x, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/5a88a2db-3bbb-44ab-9b45-68a28af5f179.png 2x"
        data-sizes="auto"
        alt="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/5a88a2db-3bbb-44ab-9b45-68a28af5f179.png"
        title="Linux 安装 MySQL 8 数据库13.png" /></p>
<p>（7）再次执行firewall-cmd &ndash;permanent &ndash;zone=public &ndash;add-port=3306/tcp ，提示success，表示设置成功，这样就可以继续后面的设置了。</p>
<p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/55085161-ee77-4b89-bd36-9f5ed60e3598.png"
        data-srcset="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/55085161-ee77-4b89-bd36-9f5ed60e3598.png, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/55085161-ee77-4b89-bd36-9f5ed60e3598.png 1.5x, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/55085161-ee77-4b89-bd36-9f5ed60e3598.png 2x"
        data-sizes="auto"
        alt="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/55085161-ee77-4b89-bd36-9f5ed60e3598.png"
        title="Linux 安装 MySQL 8 数据库14.png" /></p>
<p>（8）刷新</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-shell" data-lang="shell">firewall-cmd --reload
</code></pre></td></tr></table>
</div>
</div><p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/8e79b192-4b9d-4cf2-a19b-cb801a588938.png"
        data-srcset="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/8e79b192-4b9d-4cf2-a19b-cb801a588938.png, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/8e79b192-4b9d-4cf2-a19b-cb801a588938.png 1.5x, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/8e79b192-4b9d-4cf2-a19b-cb801a588938.png 2x"
        data-sizes="auto"
        alt="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/8e79b192-4b9d-4cf2-a19b-cb801a588938.png"
        title="Linux 安装 MySQL 8 数据库15.png" /></p>
<h4 id="252-root远程访问">2.5.2. root远程访问</h4>
<p>当防火墙开启后，Navicat访问出现如下图：</p>
<p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/0b2fa002-f236-475a-a044-619d27fe824a.png"
        data-srcset="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/0b2fa002-f236-475a-a044-619d27fe824a.png, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/0b2fa002-f236-475a-a044-619d27fe824a.png 1.5x, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/0b2fa002-f236-475a-a044-619d27fe824a.png 2x"
        data-sizes="auto"
        alt="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/0b2fa002-f236-475a-a044-619d27fe824a.png"
        title="Linux 安装 MySQL 8 数据库16.png" /></p>
<p>（1）设置认证方式。 如果你没有设置认证方式，默认的密码加密方式是：caching_sha2_password，而现在很多客户端工具还不支持这种加密认证方式，连接测试的时候就会报错：</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-shell" data-lang="shell">client does not support  authentication protocol requested by server<span class="p">;</span> consider upgrading MySQL client
</code></pre></td></tr></table>
</div>
</div><p>这里的错误信息就是不支持身份认证方式，没关系，编辑/etc/my.cnf（编辑命令：vim /etc/my.cnf）文件里面在[mysqld]下面加上这句话即可：</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-shell" data-lang="shell"><span class="nv">default_authentication_plugin</span><span class="o">=</span>mysql_native_password
</code></pre></td></tr></table>
</div>
</div><p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/494fd374-539e-47fa-8f2d-b30b0dd00b6b.png"
        data-srcset="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/494fd374-539e-47fa-8f2d-b30b0dd00b6b.png, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/494fd374-539e-47fa-8f2d-b30b0dd00b6b.png 1.5x, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/494fd374-539e-47fa-8f2d-b30b0dd00b6b.png 2x"
        data-sizes="auto"
        alt="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/494fd374-539e-47fa-8f2d-b30b0dd00b6b.png"
        title="Linux 安装 MySQL 8 数据库17.png" /></p>
<p>（2）登陆到mysql命令行：然后输入密码</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-shell" data-lang="shell">mysql -u root -p
</code></pre></td></tr></table>
</div>
</div><p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/63477ce0-4fcf-41fe-b70e-ff267566a586.png"
        data-srcset="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/63477ce0-4fcf-41fe-b70e-ff267566a586.png, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/63477ce0-4fcf-41fe-b70e-ff267566a586.png 1.5x, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/63477ce0-4fcf-41fe-b70e-ff267566a586.png 2x"
        data-sizes="auto"
        alt="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/63477ce0-4fcf-41fe-b70e-ff267566a586.png"
        title="Linux 安装 MySQL 8 数据库18.png" /></p>
<p>（3）进入之后选择mysql库，用户信息都存在这个库的user表中</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-SQL" data-lang="SQL"><span class="n">use</span> <span class="n">mysql</span><span class="p">;</span>
<span class="k">select</span> <span class="k">host</span><span class="p">,</span> <span class="k">user</span><span class="p">,</span> <span class="n">authentication_string</span><span class="p">,</span> <span class="n">plugin</span> <span class="k">from</span> <span class="k">user</span><span class="p">;</span>
</code></pre></td></tr></table>
</div>
</div><p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/426377bb-751d-4890-9dc3-d191f15721a5.png"
        data-srcset="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/426377bb-751d-4890-9dc3-d191f15721a5.png, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/426377bb-751d-4890-9dc3-d191f15721a5.png 1.5x, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/426377bb-751d-4890-9dc3-d191f15721a5.png 2x"
        data-sizes="auto"
        alt="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/426377bb-751d-4890-9dc3-d191f15721a5.png"
        title="Linux 安装 MySQL 8 数据库19.png" />居中</p>
<p>可以看到，用户对应的主机是localhost，而不是%，所以不能连接。 （4）授权root用户可以远程登陆</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-SQL" data-lang="SQL"><span class="k">update</span> <span class="k">user</span> <span class="k">set</span> <span class="k">host</span><span class="o">=</span><span class="s1">&#39;%&#39;</span> <span class="k">where</span> <span class="k">user</span> <span class="o">=</span> <span class="s1">&#39;root&#39;</span><span class="p">;</span>
<span class="n">flush</span> <span class="k">privileges</span><span class="p">;</span>
</code></pre></td></tr></table>
</div>
</div><p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/0eca199c-1a32-4a83-a634-44648f0ec276.png"
        data-srcset="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/0eca199c-1a32-4a83-a634-44648f0ec276.png, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/0eca199c-1a32-4a83-a634-44648f0ec276.png 1.5x, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/0eca199c-1a32-4a83-a634-44648f0ec276.png 2x"
        data-sizes="auto"
        alt="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/0eca199c-1a32-4a83-a634-44648f0ec276.png"
        title="Linux 安装 MySQL 8 数据库20.png" /></p>
<p>（5）刷新权限</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-SQL" data-lang="SQL"><span class="n">flush</span> <span class="k">privileges</span><span class="p">;</span>
</code></pre></td></tr></table>
</div>
</div><p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/2fdc9aa1-1f40-4882-8972-6302867667a2.png"
        data-srcset="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/2fdc9aa1-1f40-4882-8972-6302867667a2.png, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/2fdc9aa1-1f40-4882-8972-6302867667a2.png 1.5x, https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/2fdc9aa1-1f40-4882-8972-6302867667a2.png 2x"
        data-sizes="auto"
        alt="https://geshanzsq.com/geshanzsq-file/profile/upload/2020/12/07/2fdc9aa1-1f40-4882-8972-6302867667a2.png"
        title="Linux 安装 MySQL 8 数据库21.png" /></p>
<h4 id="26阿里云设置安全组需要开放3306端口">2.6阿里云设置安全组需要开放3306端口</h4>
<p>安全组&mdash;配置规则&mdash;快速添加即可</p>
<p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210423200433985.png"
        data-srcset="https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210423200433985.png, https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210423200433985.png 1.5x, https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210423200433985.png 2x"
        data-sizes="auto"
        alt="https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210423200433985.png"
        title="image-20210423200433985" /></p>
<p>此时，数据库就已经安装配置好了。 如此详细的图文教程，你学会了吗？赶紧收藏并试试吧！</p>
<h4 id="27-2059错误的解决方案">2.7 2059错误的解决方案</h4>
<p>MySQL新版本（8以上版本）的用户登录账户加密方式是【caching_sha2_password】，Navicat不支持这种用户登录账户加密方式。</p>
<p>执行</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span><span class="lnt">4
</span><span class="lnt">5
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-fallback" data-lang="fallback">show variables like &#39;default_authentication_plugin&#39;;
select host,user,plugin from mysql.user;

ALTER USER &#39;root&#39;@&#39;%&#39; IDENTIFIED WITH mysql_native_password BY &#39;mima&#39;;
flush privileges;
</code></pre></td></tr></table>
</div>
</div><p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210423200747492.png"
        data-srcset="https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210423200747492.png, https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210423200747492.png 1.5x, https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210423200747492.png 2x"
        data-sizes="auto"
        alt="https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210423200747492.png"
        title="image-20210423200747492" /></p>
<p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210423200806117.png"
        data-srcset="https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210423200806117.png, https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210423200806117.png 1.5x, https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210423200806117.png 2x"
        data-sizes="auto"
        alt="https://luckly007.oss-cn-beijing.aliyuncs.com/img/image-20210423200806117.png"
        title="image-20210423200806117" /></p></div><div class="post-footer" id="post-footer">
    <div class="post-info">
        <div class="post-info-line">
            <div class="post-info-mod">
                <span>更新于 2021-04-23</span>
            </div>
            <div class="post-info-license"></div>
        </div>
        <div class="post-info-line">
            <div class="post-info-md"></div>
            <div class="post-info-share">
                <span><a href="javascript:void(0);" title="分享到 Twitter" data-sharer="twitter" data-url="https://luckly.work/linxu%E4%B8%8B%E5%AE%89%E8%A3%85mysql%E6%95%99%E7%A8%8B/" data-title="《Linxu下安装Mysql教程》" data-hashtags="linux,Mysql,安装教程"><i class="fab fa-twitter fa-fw"></i></a><a href="javascript:void(0);" title="分享到 Facebook" data-sharer="facebook" data-url="https://luckly.work/linxu%E4%B8%8B%E5%AE%89%E8%A3%85mysql%E6%95%99%E7%A8%8B/" data-hashtag="linux"><i class="fab fa-facebook-square fa-fw"></i></a><a href="javascript:void(0);" title="分享到 Hacker News" data-sharer="hackernews" data-url="https://luckly.work/linxu%E4%B8%8B%E5%AE%89%E8%A3%85mysql%E6%95%99%E7%A8%8B/" data-title="《Linxu下安装Mysql教程》"><i class="fab fa-hacker-news fa-fw"></i></a><a href="javascript:void(0);" title="分享到 Line" data-sharer="line" data-url="https://luckly.work/linxu%E4%B8%8B%E5%AE%89%E8%A3%85mysql%E6%95%99%E7%A8%8B/" data-title="《Linxu下安装Mysql教程》"><i data-svg-src="https://cdn.jsdelivr.net/npm/simple-icons@2.14.0/icons/line.svg"></i></a><a href="javascript:void(0);" title="分享到 微博" data-sharer="weibo" data-url="https://luckly.work/linxu%E4%B8%8B%E5%AE%89%E8%A3%85mysql%E6%95%99%E7%A8%8B/" data-title="《Linxu下安装Mysql教程》" data-image="https://luckly007.oss-cn-beijing.aliyuncs.com/img/linux.jpg"><i class="fab fa-weibo fa-fw"></i></a></span>
            </div>
        </div>
    </div>

    <div class="post-info-more">
        <section class="post-tags"><i class="fas fa-tags fa-fw"></i>&nbsp;<a href="/tags/linux/">linux</a>,&nbsp;<a href="/tags/mysql/">Mysql</a>,&nbsp;<a href="/tags/%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B/">安装教程</a></section>
        <section>
            <span><a href="javascript:void(0);" onclick="window.history.back();">返回</a></span>&nbsp;|&nbsp;<span><a href="/">主页</a></span>
        </section>
    </div>

    <div class="post-nav"><a href="/nginx%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/" class="prev" rel="prev" title="《Nginx学习笔记》"><i class="fas fa-angle-left fa-fw"></i>《Nginx学习笔记》</a>
            <a href="/go%E5%AD%A6%E4%B9%A0%E8%B5%84%E6%96%99%E5%AF%BC%E8%88%AA/" class="next" rel="next" title="《Go学习资料导航》">《Go学习资料导航》<i class="fas fa-angle-right fa-fw"></i></a></div>
</div>
<div id="comments"><div id="valine" class="comment"></div><noscript>
                Please enable JavaScript to view the comments powered by <a href="https://valine.js.org/">Valine</a>.
            </noscript></div></article></div>
            </main><footer class="footer">
        <div class="footer-container"><div class="footer-line">由 <a href="https://gohugo.io/" target="_blank" rel="noopener noreffer" title="Hugo 0.79.1">Hugo</a> 强力驱动 | 主题 - <a href="https://github.com/dillonzq/LoveIt" target="_blank" rel="noopener noreffer" title="LoveIt 0.2.10"><i class="far fa-kiss-wink-heart fa-fw"></i> LoveIt</a>
                </div><div class="footer-line"><i class="far fa-copyright fa-fw"></i><span itemprop="copyrightYear">2021</span><span class="author" itemprop="copyrightHolder">&nbsp;<a href="/" target="_blank">早起的年轻人</a></span>&nbsp;|&nbsp;<span class="license"><a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a></span></div>
        </div>
    </footer></div>

        <div id="fixed-buttons"><a href="#" id="back-to-top" class="fixed-button" title="回到顶部">
                <i class="fas fa-arrow-up fa-fw"></i>
            </a><a href="#" id="view-comments" class="fixed-button" title="查看评论">
                <i class="fas fa-comment fa-fw"></i>
            </a>
        </div><link rel="stylesheet" href="/lib/valine/valine.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/cookieconsent@3.1.1/build/cookieconsent.min.css"><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/valine@1.4.14/dist/Valine.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/smooth-scroll@16.1.3/dist/smooth-scroll.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/autocomplete.js@0.37.1/dist/autocomplete.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/algoliasearch@4.2.0/dist/algoliasearch-lite.umd.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lazysizes@5.2.2/lazysizes.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/sharer.js@0.4.0/sharer.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/typeit@7.0.4/dist/typeit.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/cookieconsent@3.1.1/build/cookieconsent.min.js"></script><script type="text/javascript">window.config={"code":{"copyTitle":"复制到剪贴板","maxShownLines":10},"comment":{"valine":{"appId":"LqsxahhaGjA96LY5Ldj1mbgq-MdYXbMMI","appKey":"Hdb0imPTOlWHWe8MY3bD8tln","avatar":"robohash","el":"#valine","emojiCDN":"https://cdn.jsdelivr.net/npm/emoji-datasource-google@5.0.1/img/google/64/","emojiMaps":{"100":"1f4af.png","alien":"1f47d.png","anger":"1f4a2.png","angry":"1f620.png","anguished":"1f627.png","astonished":"1f632.png","black_heart":"1f5a4.png","blue_heart":"1f499.png","blush":"1f60a.png","bomb":"1f4a3.png","boom":"1f4a5.png","broken_heart":"1f494.png","brown_heart":"1f90e.png","clown_face":"1f921.png","cold_face":"1f976.png","cold_sweat":"1f630.png","confounded":"1f616.png","confused":"1f615.png","cry":"1f622.png","crying_cat_face":"1f63f.png","cupid":"1f498.png","dash":"1f4a8.png","disappointed":"1f61e.png","disappointed_relieved":"1f625.png","dizzy":"1f4ab.png","dizzy_face":"1f635.png","drooling_face":"1f924.png","exploding_head":"1f92f.png","expressionless":"1f611.png","face_vomiting":"1f92e.png","face_with_cowboy_hat":"1f920.png","face_with_hand_over_mouth":"1f92d.png","face_with_head_bandage":"1f915.png","face_with_monocle":"1f9d0.png","face_with_raised_eyebrow":"1f928.png","face_with_rolling_eyes":"1f644.png","face_with_symbols_on_mouth":"1f92c.png","face_with_thermometer":"1f912.png","fearful":"1f628.png","flushed":"1f633.png","frowning":"1f626.png","ghost":"1f47b.png","gift_heart":"1f49d.png","green_heart":"1f49a.png","grimacing":"1f62c.png","grin":"1f601.png","grinning":"1f600.png","hankey":"1f4a9.png","hear_no_evil":"1f649.png","heart":"2764-fe0f.png","heart_decoration":"1f49f.png","heart_eyes":"1f60d.png","heart_eyes_cat":"1f63b.png","heartbeat":"1f493.png","heartpulse":"1f497.png","heavy_heart_exclamation_mark_ornament":"2763-fe0f.png","hole":"1f573-fe0f.png","hot_face":"1f975.png","hugging_face":"1f917.png","hushed":"1f62f.png","imp":"1f47f.png","innocent":"1f607.png","japanese_goblin":"1f47a.png","japanese_ogre":"1f479.png","joy":"1f602.png","joy_cat":"1f639.png","kiss":"1f48b.png","kissing":"1f617.png","kissing_cat":"1f63d.png","kissing_closed_eyes":"1f61a.png","kissing_heart":"1f618.png","kissing_smiling_eyes":"1f619.png","laughing":"1f606.png","left_speech_bubble":"1f5e8-fe0f.png","love_letter":"1f48c.png","lying_face":"1f925.png","mask":"1f637.png","money_mouth_face":"1f911.png","nauseated_face":"1f922.png","nerd_face":"1f913.png","neutral_face":"1f610.png","no_mouth":"1f636.png","open_mouth":"1f62e.png","orange_heart":"1f9e1.png","partying_face":"1f973.png","pensive":"1f614.png","persevere":"1f623.png","pleading_face":"1f97a.png","pouting_cat":"1f63e.png","purple_heart":"1f49c.png","rage":"1f621.png","relaxed":"263a-fe0f.png","relieved":"1f60c.png","revolving_hearts":"1f49e.png","right_anger_bubble":"1f5ef-fe0f.png","robot_face":"1f916.png","rolling_on_the_floor_laughing":"1f923.png","scream":"1f631.png","scream_cat":"1f640.png","see_no_evil":"1f648.png","shushing_face":"1f92b.png","skull":"1f480.png","skull_and_crossbones":"2620-fe0f.png","sleeping":"1f634.png","sleepy":"1f62a.png","slightly_frowning_face":"1f641.png","slightly_smiling_face":"1f642.png","smile":"1f604.png","smile_cat":"1f638.png","smiley":"1f603.png","smiley_cat":"1f63a.png","smiling_face_with_3_hearts":"1f970.png","smiling_imp":"1f608.png","smirk":"1f60f.png","smirk_cat":"1f63c.png","sneezing_face":"1f927.png","sob":"1f62d.png","space_invader":"1f47e.png","sparkling_heart":"1f496.png","speak_no_evil":"1f64a.png","speech_balloon":"1f4ac.png","star-struck":"1f929.png","stuck_out_tongue":"1f61b.png","stuck_out_tongue_closed_eyes":"1f61d.png","stuck_out_tongue_winking_eye":"1f61c.png","sunglasses":"1f60e.png","sweat":"1f613.png","sweat_drops":"1f4a6.png","sweat_smile":"1f605.png","thinking_face":"1f914.png","thought_balloon":"1f4ad.png","tired_face":"1f62b.png","triumph":"1f624.png","two_hearts":"1f495.png","unamused":"1f612.png","upside_down_face":"1f643.png","weary":"1f629.png","white_frowning_face":"2639-fe0f.png","white_heart":"1f90d.png","wink":"1f609.png","woozy_face":"1f974.png","worried":"1f61f.png","yawning_face":"1f971.png","yellow_heart":"1f49b.png","yum":"1f60b.png","zany_face":"1f92a.png","zipper_mouth_face":"1f910.png","zzz":"1f4a4.png"},"enableQQ":true,"highlight":true,"lang":true,"meta":true,"pageSize":true,"placeholder":"说点什么吧...","recordIP":true,"visitor":true}},"cookieconsent":{"content":{"dismiss":"同意","link":"了解更多","message":"本网站使用 Cookies 来改善您的浏览体验."},"enable":true,"palette":{"button":{"background":"#f0f0f0"},"popup":{"background":"#1aa3ff"}},"theme":"edgeless"},"data":{"id-1":"早起的年轻人","id-2":"早起的年轻人"},"search":{"algoliaAppID":"PASDMWALPK","algoliaIndex":"index.zh-cn","algoliaSearchKey":"b42948e51daaa93df92381c8e2ac0f93","highlightTag":"em","maxResultLength":10,"noResultsFound":"没有找到结果","snippetLength":50,"type":"algolia"},"typeit":{"cursorChar":"|","cursorSpeed":1000,"data":{"id-1":["id-1"],"id-2":["id-2"]},"duration":-1,"speed":100}};</script><script type="text/javascript" src="/js/theme.min.js"></script></body>
</html>
